/**
 * 由 CoCo 源代码计划解包器解包
 *
 * 模块 ID：270__part-6
 */

"use strict"

import { "270__part-2__I" as I } from "./index__part-2"
import { "270__part-5__Ae" as Ae } from "./index__part-5"
import * as /* [auto-meaningful-name] */$$_$$_$$_75_index from "../../../75/index"
import * as /* [auto-meaningful-name] */$$_$$_$$_549_1186_315_2632 from "../../../549/1186/315/2632"
import * as /* [auto-meaningful-name] */$_390 from "./390"
import * as /* [auto-meaningful-name] */$$_$$_$$_108 from "../../../108"
import * as /* [auto-meaningful-name] */$$_$$_$$_33_index from "../../../33/index"
import * as /* [auto-meaningful-name] */$$_$$_$$_549_1186_682_index from "../../../549/1186/682/index"
import * as /* [auto-meaningful-name] */$$_$$_$$_549_1186_315_288 from "../../../549/1186/315/288"
import * as /* [auto-meaningful-name] */$$_691_234 from "../691/234"
import * as /* [auto-meaningful-name] */$_1506 from "./1506"
import * as /* [auto-meaningful-name] */$$_691_153 from "../691/153"
import * as /* [auto-meaningful-name] */$$_$$_$$_54 from "../../../54"
import * as /* [auto-meaningful-name] */$$_$$_$$_19 from "../../../19"
import * as /* [auto-meaningful-name] */$$_100 from "../100"
import * as /* [auto-meaningful-name] */React from "react"
import * as /* [auto-meaningful-name] */$_689 from "./689"
var ve = {
  vertical: "top",
  horizontal: "right"
}
var me = {
  vertical: "top",
  horizontal: "left"
}
var ye = React.forwardRef(function (e, t) {
  var /* [auto-meaningful-name] */e$autoFocus = e.autoFocus
  var r = undefined === e$autoFocus || e$autoFocus
  var /* [auto-meaningful-name] */e$children = e.children
  var /* [auto-meaningful-name] */e$classes = e.classes
  var /* [auto-meaningful-name] */e$disableAutoFocusItem = e.disableAutoFocusItem
  var f = undefined !== e$disableAutoFocusItem && e$disableAutoFocusItem
  var /* [auto-meaningful-name] */e$MenuListProps = e.MenuListProps
  var h = undefined === e$MenuListProps ? {} : e$MenuListProps
  var /* [auto-meaningful-name] */e$onClose = e.onClose
  var /* [auto-meaningful-name] */e$onEntering = e.onEntering
  var /* [auto-meaningful-name] */e$open = e.open
  var /* [auto-meaningful-name] */e$PaperProps = e.PaperProps
  var v = undefined === e$PaperProps ? {} : e$PaperProps
  var /* [auto-meaningful-name] */e$PopoverClasses = e.PopoverClasses
  var /* [auto-meaningful-name] */e$transitionDuration = e.transitionDuration
  var b = undefined === e$transitionDuration ? "auto" : e$transitionDuration
  var /* [auto-meaningful-name] */e$TransitionProps = e.TransitionProps
  var /* [auto-meaningful-name] */E$TransitionPropsUndefinedE$TransitionPropsE$TransitionProps$onEntering = (e$TransitionProps = undefined === e$TransitionProps ? {} : e$TransitionProps).onEntering
  var x = $$_$$_$$_54.a(e$TransitionProps, ["onEntering"])
  var /* [auto-meaningful-name] */e$variant = e.variant
  var O = undefined === e$variant ? "selectedMenu" : e$variant
  var k = $$_$$_$$_54.a(e, ["autoFocus", "children", "classes", "disableAutoFocusItem", "MenuListProps", "onClose", "onEntering", "open", "PaperProps", "PopoverClasses", "transitionDuration", "TransitionProps", "variant"])
  var S = $$_$$_$$_549_1186_682_index.a()
  var T = r && !f && e$open
  var B = React.useRef(null)
  var D = React.useRef(null)
  var I = -1
  React.Children.map(e$children, function (e, t) {
    if (React.isValidElement(e)) {
      if (!e.props.disabled) {
        if ("menu" !== O && e.props.selected || -1 === I) {
          I = t
        }
      }
    }
  })
  var F = React.Children.map(e$children, function (e, t) {
    return t === I ? React.cloneElement(e, {
      ref: function (t) {
        D.current = $$_$$_$$_75_index.findDOMNode(t)
        $_689.a(e.ref, t)
      }
    }) : e
  })
  return React.createElement($$_$$_$$_549_1186_315_2632.a, $$_$$_$$_19.a({
    getContentAnchorEl: function () {
      return D.current
    },
    classes: e$PopoverClasses,
    onClose: e$onClose,
    TransitionProps: $$_$$_$$_19.a({
      onEntering: function (e, t) {
        if (B.current) {
          B.current.adjustStyleForScrollbar(e, S)
        }
        if (e$onEntering) {
          e$onEntering(e, t)
        }
        if (E$TransitionPropsUndefinedE$TransitionPropsE$TransitionProps$onEntering) {
          E$TransitionPropsUndefinedE$TransitionPropsE$TransitionProps$onEntering(e, t)
        }
      }
    }, x),
    anchorOrigin: "rtl" === S.direction ? ve : me,
    transformOrigin: "rtl" === S.direction ? ve : me,
    PaperProps: $$_$$_$$_19.a({}, v, {
      classes: $$_$$_$$_19.a({}, v.classes, {
        root: e$classes.paper
      })
    }),
    open: e$open,
    ref: t,
    transitionDuration: b
  }, k), React.createElement(Ae, $$_$$_$$_19.a({
    onKeyDown: function (e) {
      if ("Tab" === e.key) {
        e.preventDefault()
        if (e$onClose) {
          e$onClose(e, "tabKeyDown")
        }
      }
    },
    actions: B,
    autoFocus: r && (-1 === I || f),
    autoFocusItem: T,
    variant: O
  }, h, {
    className: $$_100.a(e$classes.list, h.className)
  }), F))
})
var be = $$_691_153.a({
  paper: {
    maxHeight: "calc(100% - 96px)",
    WebkitOverflowScrolling: "touch"
  },
  list: {
    outline: 0
  }
}, {
  name: "MuiMenu"
})(ye)
function we(e, t) {
  return "object" === $$_$$_$$_108.a(t) && null !== t ? e === t : String(e) === String(t)
}
var Ee = React.forwardRef(function (e, t) {
  var n = e["aria-label"]
  var /* [auto-meaningful-name] */e$autoFocus = e.autoFocus
  var /* [auto-meaningful-name] */e$autoWidth = e.autoWidth
  var /* [auto-meaningful-name] */e$children = e.children
  var /* [auto-meaningful-name] */e$classes = e.classes
  var /* [auto-meaningful-name] */e$className = e.className
  var /* [auto-meaningful-name] */e$defaultValue = e.defaultValue
  var /* [auto-meaningful-name] */e$disabled = e.disabled
  var /* [auto-meaningful-name] */e$displayEmpty = e.displayEmpty
  var /* [auto-meaningful-name] */e$IconComponent = e.IconComponent
  var /* [auto-meaningful-name] */e$inputRef = e.inputRef
  var /* [auto-meaningful-name] */e$labelId = e.labelId
  var /* [auto-meaningful-name] */e$MenuProps = e.MenuProps
  var y = undefined === e$MenuProps ? {} : e$MenuProps
  var /* [auto-meaningful-name] */e$multiple = e.multiple
  var /* [auto-meaningful-name] */e$name = e.name
  var /* [auto-meaningful-name] */e$onBlur = e.onBlur
  var /* [auto-meaningful-name] */e$onChange = e.onChange
  var /* [auto-meaningful-name] */e$onClose = e.onClose
  var /* [auto-meaningful-name] */e$onFocus = e.onFocus
  var /* [auto-meaningful-name] */e$onOpen = e.onOpen
  var /* [auto-meaningful-name] */e$open = e.open
  var /* [auto-meaningful-name] */e$readOnly = e.readOnly
  var /* [auto-meaningful-name] */e$renderValue = e.renderValue
  var /* [auto-meaningful-name] */e$SelectDisplayProps = e.SelectDisplayProps
  var P = undefined === e$SelectDisplayProps ? {} : e$SelectDisplayProps
  var /* [auto-meaningful-name] */e$tabIndex = e.tabIndex
  e.type
  var /* [auto-meaningful-name] */e$value = e.value
  var /* [auto-meaningful-name] */e$variant = e.variant
  var L = undefined === e$variant ? "standard" : e$variant
  var U = $$_$$_$$_54.a(e, ["aria-label", "autoFocus", "autoWidth", "children", "classes", "className", "defaultValue", "disabled", "displayEmpty", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"])
  var H = function (e) {
    var /* [auto-meaningful-name] */e$controlled = e.controlled
    var /* [auto-meaningful-name] */e$default = e.default
    e.name
    e.state
    var /* [auto-meaningful-name] */React$useRefUndefinedE$controlled$current = React.useRef(undefined !== e$controlled).current
    var o = React.useState(e$default)
    var a = o[0]
    var s = o[1]
    return [React$useRefUndefinedE$controlled$current ? e$controlled : a, React.useCallback(function (e) {
      if (!React$useRefUndefinedE$controlled$current) {
        s(e)
      }
    }, [])]
  }({
    controlled: e$value,
    default: e$defaultValue,
    name: "Select"
  })
  var V = $$_$$_$$_33_index.a(H, 2)
  var G = V[0]
  var z = V[1]
  var Q = React.useRef(null)
  var W = React.useState(null)
  var K = W[0]
  var X = W[1]
  var /* [auto-meaningful-name] */React$useRefNullE$open$current = React.useRef(null != e$open).current
  var q = React.useState()
  var $ = q[0]
  var J = q[1]
  var Z = React.useState(false)
  var ee = Z[0]
  var te = Z[1]
  var re = $$_$$_$$_549_1186_315_288.a(t, e$inputRef)
  React.useImperativeHandle(re, function () {
    return {
      focus: function () {
        K.focus()
      },
      node: Q.current,
      value: G
    }
  }, [K, G])
  React.useEffect(function () {
    if (e$autoFocus && K) {
      K.focus()
    }
  }, [e$autoFocus, K])
  React.useEffect(function () {
    if (K) {
      var e = $_390.a(K).getElementById(e$labelId)
      if (e) {
        var t = function () {
          if (getSelection().isCollapsed) {
            K.focus()
          }
        }
        e.addEventListener("click", t)
        return function () {
          e.removeEventListener("click", t)
        }
      }
    }
  }, [e$labelId, K])
  var oe
  var /* [auto-meaningful-name] */e$props$children
  var se = function (e, t) {
    if (e) {
      if (e$onOpen) {
        e$onOpen(t)
      }
    } else {
      if (e$onClose) {
        e$onClose(t)
      }
    }
    if (!React$useRefNullE$open$current) {
      J(e$autoWidth ? null : K.clientWidth)
      te(e)
    }
  }
  var ce = React.Children.toArray(e$children)
  var ue = function (e) {
    return function (t) {
      var n
      if (!e$multiple) {
        se(false, t)
      }
      if (e$multiple) {
        n = Array.isArray(G) ? G.slice() : []
        var r = G.indexOf(e.props.value)
        if (-1 === r) {
          n.push(e.props.value)
        } else {
          n.splice(r, 1)
        }
      } else {
        n = e.props.value
      }
      if (e.props.onClick) {
        e.props.onClick(t)
      }
      if (G !== n) {
        z(n)
        if (e$onChange) {
          t.persist()
          Object.defineProperty(t, "target", {
            writable: true,
            value: {
              value: n,
              name: e$name
            }
          })
          e$onChange(t, e)
        }
      }
    }
  }
  var le = null !== K && (React$useRefNullE$open$current ? e$open : ee)
  delete U["aria-invalid"]
  var fe = []
  var de = false
  if (I({
    value: G
  }) || e$displayEmpty) {
    if (e$renderValue) {
      oe = e$renderValue(G)
    } else {
      de = true
    }
  }
  var he = ce.map(function (e) {
    if (!React.isValidElement(e)) {
      return null
    }
    var t
    if (e$multiple) {
      if (!Array.isArray(G)) {
        throw new Error($_1506.a(2))
      }
      if ((t = G.some(function (t) {
        return we(t, e.props.value)
      })) && de) {
        fe.push(e.props.children)
      }
    } else if ((t = we(G, e.props.value)) && de) {
      e$props$children = e.props.children
    }
    if (t) {
      true
    }
    return React.cloneElement(e, {
      "aria-selected": t ? "true" : undefined,
      onClick: ue(e),
      onKeyUp: function (t) {
        if (" " === t.key) {
          t.preventDefault()
        }
        if (e.props.onKeyUp) {
          e.props.onKeyUp(t)
        }
      },
      role: "option",
      selected: t,
      value: undefined,
      "data-value": e.props.value
    })
  })
  if (de) {
    oe = e$multiple ? fe.join(", ") : e$props$children
  }
  var pe
  var _e = $
  if (!e$autoWidth && React$useRefNullE$open$current && K) {
    _e = K.clientWidth
  }
  pe = "undefined" !== typeof e$tabIndex ? e$tabIndex : e$disabled ? null : 0
  var Ae = P.id || (e$name ? "mui-component-select-".concat(e$name) : undefined)
  return React.createElement(React.Fragment, null, React.createElement("div", $$_$$_$$_19.a({
    className: $$_100.a(e$classes.root, e$classes.select, e$classes.selectMenu, e$classes[L], e$className, e$disabled && e$classes.disabled),
    ref: X,
    tabIndex: pe,
    role: "button",
    "aria-disabled": e$disabled ? "true" : undefined,
    "aria-expanded": le ? "true" : undefined,
    "aria-haspopup": "listbox",
    "aria-label": n,
    "aria-labelledby": [e$labelId, Ae].filter(Boolean).join(" ") || undefined,
    onKeyDown: function (e) {
      if (!e$readOnly) {
        if (-1 !== [" ", "ArrowUp", "ArrowDown", "Enter"].indexOf(e.key)) {
          e.preventDefault()
          se(true, e)
        }
      }
    },
    onMouseDown: e$disabled || e$readOnly ? null : function (e) {
      if (0 === e.button) {
        e.preventDefault()
        K.focus()
        se(true, e)
      }
    },
    onBlur: function (e) {
      if (!le && e$onBlur) {
        e.persist()
        Object.defineProperty(e, "target", {
          writable: true,
          value: {
            value: G,
            name: e$name
          }
        })
        e$onBlur(e)
      }
    },
    onFocus: e$onFocus
  }, P, {
    id: Ae
  }), function (e) {
    return null == e || "string" === typeof e && !e.trim()
  }(oe) ? React.createElement("span", {
    dangerouslySetInnerHTML: {
      __html: "&#8203;"
    }
  }) : oe), React.createElement("input", $$_$$_$$_19.a({
    value: Array.isArray(G) ? G.join(",") : G,
    name: e$name,
    ref: Q,
    "aria-hidden": true,
    onChange: function (e) {
      var t = ce.map(function (e) {
        return e.props.value
      }).indexOf(e.target.value)
      if (-1 !== t) {
        var n = ce[t]
        z(n.props.value)
        if (e$onChange) {
          e$onChange(e, n)
        }
      }
    },
    tabIndex: -1,
    className: e$classes.nativeInput,
    autoFocus: e$autoFocus
  }, U)), React.createElement(e$IconComponent, {
    className: $$_100.a(e$classes.icon, e$classes["icon".concat($$_691_234.a(L))], le && e$classes.iconOpen, e$disabled && e$classes.disabled)
  }), React.createElement(be, $$_$$_$$_19.a({
    id: "menu-".concat(e$name || ""),
    anchorEl: K,
    open: le,
    onClose: function (e) {
      se(false, e)
    }
  }, y, {
    MenuListProps: $$_$$_$$_19.a({
      "aria-labelledby": e$labelId,
      role: "listbox",
      disableListWrap: true
    }, y.MenuListProps),
    PaperProps: $$_$$_$$_19.a({}, y.PaperProps, {
      style: $$_$$_$$_19.a({
        minWidth: _e
      }, null != y.PaperProps ? y.PaperProps.style : null)
    })
  }), he))
})
export { Ee as "270__part-6__Ee" }
